<?php
	echo $this->Html->script('jquery.lightbox-0.5.pack');
	echo $this->Html->css('jquery.lightbox-0.5');
	$col = 5;
	$row = ceil(count($products)/$col);
?>
<div style="margin-top:20px">
	<table width="100%" align="center">
	<?php  for($m =0; $m < 1; $m++) { ?>
			<tr>
			<?php for($n =0; $n<  $col; $n++) { ?>
				<td align="center">
					<?php
					if(isset($products[$m * $col + $n])) {
						$item = $products[$m * $col + $n];
						$img = (empty($item['Product']['img'])? "no.jpg" : $item['Product']['img'] );
						echo $html->link(
								$html->image(
									IMG_URL ."products/{$img}",
									array(
										'alt'		=> $item['Product']['name_'.$lang],
										'class'		=> 'productImg',
										'width'		=> '120px',
										'height'	=> '90px'
									)
								),
								array('controller'=> 'product','action' => 'detail',$item['Product']['id']),
								array(
									'title'			=> $item['Product']['name_'.$lang],
									'rel'			=> 'nofollow',
									'escape'		=> false,
									'class'			=> 'preview'
								)
							);
					?>
					<a href="<?php echo Router::url(array('controller'=> 'product','action' => 'detail',$item['Product']['id'])); ?>" title="Macbook" class="title"><?php echo $item['Product']['name_'.$lang]?></a>
					<span class="price"><?php echo number_format($item['Product']['price'],0,' ','.')?> VNĐ</span>
					<?php 
						if ($item['Product']['type'] == 1) {
							echo "<strong style='color:#333'>".__('Contact', true)."</strong>";
						}
						else {
							if ($item['Product']['sold'] == 0) {
								?>
									<div id="mua">
										<a href="<?php echo Router::url(array('controller' => 'product','action' => 'order',$item['Product']['id'],'index'));?>"><?php echo __('Order', true); ?></a>
									</div>
								<?php
								}
								else {
								?>
									<div class="sold" align="right">
										<?php echo $html->image('button_sold_out_'.$lang.'.gif',array('width' => '48px'))?>
										</div>
								<?php
								}
							}
					?>

					<?php
					}
					?>

				</td>
				<?php
				}
				?>
			</tr>
		<?php
			}
		?>
		</tbody>
	</table>
</div>